package thesis.database;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;


public class UserMapper implements RowMapper<User> {

	@Override
	public User mapRow(ResultSet rs, int rowNum) throws SQLException {
		User user = new User();
		user.setActive(rs.getBoolean("is_active"));
		user.setAddress(rs.getString("address"));
		user.setBirthDay(rs.getTimestamp("birth_day"));
		user.setBirthPlace(rs.getString("birth_place"));
		user.setCreationTime(rs.getTimestamp("creation_time"));
		user.setEmail(rs.getString("email"));
		user.setGender(rs.getBoolean("gender"));
		user.setIdentifyNumber(rs.getString("identify_number"));
		user.setLastLoginTime(rs.getTimestamp("last_login_time"));
		user.setLastUpdate(rs.getTimestamp("last_update"));
		user.setName(rs.getString("name"));
		user.setPassword(rs.getString("password"));
		user.setPhoneNumber(rs.getString("phone_number"));
		user.setUserId(rs.getInt("user_id"));
		user.setUserName(rs.getString("user_name"));
		user.setUserType(rs.getString("user_type"));
		return user;
	}

}
